class Solution {
public:
    double minimumAverage(vector<int>& nums)
    {
        ranges::sort(nums);
        int n = nums.size();
        double ans = 0x3f3f3f3f;
        for (int i = 0, j = n - 1; i < j; i++, j--)
            ans = min(ans, 1.0 * (nums[i] + nums[j]) / 2);
        return ans;
    }
};